package com.glory.brepda.adapter;

import android.content.Intent;
import android.os.Bundle;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.glory.brepda.R;
import com.glory.brepda.activity.mfg.BomInfoCheckActivity;
import com.glory.brepda.activity.mfg.WBWorkEnd2Activity;
import com.glory.brepda.activity.technicalservice.ChangeWorkOrdersActivity;
import com.glory.brepda.activity.technicalservice.FaultRepairCheckActivity;
import com.glory.brepda.activity.technicalservice.QCConfirmActivity;
import com.glory.brepda.activity.technicalservice.ReplaceMaterialActivity;
import com.glory.brepda.activity.technicalservice.ReplaceProductActivity;
import com.glory.brepda.activity.technicalservice.ReplaceToolActivity;
import com.glory.brepda.activity.technicalservice.WaitForEightHoursActivity;
import com.glory.brepda.entity.BomInfoEntity;
import com.glory.brepda.entity.RepairFromListEntity;
import com.pda.platform.ui.ui_pdaplatform.utils_public.FreeApi_LogUtils;
import com.pda.platform.ui.ui_pdaplatform.utils_public.FreeApi_ToastUtils;
import com.pda.platform.ui.ui_pdaplatform.utils_public.FreeApi_Utils;

import java.util.List;

public class BomInfoListAdapter extends BaseQuickAdapter<BomInfoEntity.ResultBean, BaseViewHolder> {
    private boolean mStatus = true;

    public BomInfoListAdapter(@Nullable List<BomInfoEntity.ResultBean> data, boolean status) {
        super(R.layout.item_bom_info_adapter,data);
        this.mStatus = status;
    }

    @Override
    protected void convert(BaseViewHolder helper, BomInfoEntity.ResultBean item) {
        helper.setText(R.id.tvMaterialDesc,item.getMATERIAL_DESC());
        helper.setText(R.id.tvMaterialType,item.getMATERIAL_TYPE());
        helper.setText(R.id.tvWorkStepDesc,item.getWORK_STEP_DESC());

        helper.getView(R.id.llRepairLayout).setOnClickListener(view -> {
            //判断是否可点击
            if (mStatus)
                return;
            Bundle bundle= new Bundle();
            bundle.putSerializable("BOMINFO",item);


            FreeApi_LogUtils.saveErrorMessages(item.toString(),"BOMINFO");

            FreeApi_Utils.skipWithExtraIntent("header",bundle,mContext, BomInfoCheckActivity.class);

        });
    }
}
